# coding=UTF-8
from django.template import Library, Node, Template, TemplateSyntaxError, Variable
from django.utils.translation import ugettext as _
from django.conf import settings
from os import path, makedirs

register = Library()

class CommentNode(Node):
    def __init__(self):
        pass

    def render(self, context):
        html = ''
        for tpl in settings.TEMPLATE_DIRS:
            template_path = tpl + "/djopping/core/product_comment.html"
            if path.exists(template_path):
                comment = Template(open(template_path, 'r').read())
        if comment:
            product = context['product']
            for comment in product.get_parent_comments():
                pass
        return html

def Comments(parser, token):
    bits = token.contents.split()
    if len(bits) != 1:
        raise TemplateSyntaxError, _(u'render_comments no recibe parámetros.')
    return CommentNode()

product_comments = register.tag('render_comments', Comments)

